#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/2/15 11:33
# @Author  : ldh
from time import sleep

from basic.UIParent import UIParent
from basic.utils.asserts import asserts
from commen.page.awz.awz_login_page import awz_login_page
from commen.page.awz.awz_myinfo_page import awz_myinfo_page
from basic.utils.readConfig.GetConfigValue import GetValue


class awz_myinfo(UIParent) :

    @classmethod
    def test1_loginbypwd(cls) :
        '''账号密码登录'''
        awz_myinfo_page.open_mypage()
        if awz_myinfo_page.iflogin() == False :
            print("用户尚未登录！")
            awz_login_page.loginByPwd(GetValue.read("login", "awz_phone"), GetValue.read("login", "awz_pwd"))
        else :
            print("您已登录！")
        sleep(3)
        awz_myinfo_page.get_userinfo()

    @classmethod
    def test2_checkinfo(cls) :
        '''校验用户信息'''
        awz_myinfo_page.open_mypage()
        tel = awz_myinfo_page.get_userinfo()
        phoneNum = awz_myinfo_page.myinfo()
        asserts.equal(tel, phoneNum, "用户账号/手机号校验")

    @classmethod
    def test3_editnickname(cls) :
        '''修改昵称'''
        awz_myinfo_page.open_mypage()
        awz_myinfo_page.myinfo()
        awz_myinfo_page.nickName()
        awz_myinfo_page.editNickName()
        awz_myinfo_page.nickNameBack()
